package cn.fuck;

import org.jetbrains.annotations.NotNull;
import org.junit.Test;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Tool {

    public static <T> void uShow(String tag, @NotNull Stream<T> stream) {
        System.out.print(tag + ": ");
        List<T> list =
                stream.collect(Collectors.toList());
        for (int i = 0; i < list.size(); i++) {
            if (i > 0) {
                System.out.print(", ");
            }
            System.out.print(list.get(i));
        }
        System.out.print("...\n");

    }

    public static <T> void show(String tag, Stream<T> stream) {
        int SIZE = 10;
        System.out.print(tag + ": ");
        List<T> list =
                stream.limit(10).collect(Collectors.toList());
        for (int i = 0; i < SIZE; i++) {
            if (i > 0) {
                System.out.print(", ");
            }
            System.out.print(list.get(i));
        }
        System.out.print("...\n");

    }
}
